RM := rm -rf
C_SRCS += \
balance.c blocking_queue.c client.c

OBJS += \
balance.o blocking_queue.o client.o

LIBS := -lpthread

# All Target
all: balance-thread-local-socket-local-producer

# Tool invocations
balance-thread-local-socket-local-producer: $(OBJS) $(USER_OBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Linker'
	#gcc  -o"balance-thread-local-socket-local-producer" $(OBJS) $(USER_OBJS) $(LIBS)
	gcc  -pg -o"balance-thread-local-socket-local-producer" $(OBJS) $(USER_OBJS) $(LIBS)
	@echo 'Finished building target: $@'
	@echo ' '

%.o: %.c
	@echo 'Building file: $<'
	@echo 'Invoking: GCC C Compiler'
	#gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
	gcc -g -O0 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
	#gcc -pg -O0 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
	@echo 'Finished building: $<'
	@echo ' '
	
# Other Targets
clean:
	-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) balance-thread-local-socket-local-producer
	-@echo ' '